package com.wangzhixuan.commons.utils;

import java.io.IOException;

import ch.ethz.ssh2.Connection;
import ch.ethz.ssh2.Session;

public class SSHUtil {

	private static final String  HOSTNAME = "39.108.187.126";
	
	private static final String  USERNAME = "root";
	
	private static final String  PASSWORD = "";
	
	public static void SSH(String content) throws IOException {
            Connection conn = new Connection(HOSTNAME);
            conn.connect();
            System.out.println("connect ok");
            boolean isAuthenticated = conn.authenticateWithPassword(USERNAME,PASSWORD);
            if (isAuthenticated == false)
                    throw new IOException("Authentication failed.");
            Session sess = conn.openSession();
            sess.execCommand("rm -rf "+content);
            System.out.println("Here is some information about the remote host:");
            sess.close();
            conn.close();
   
}
}
